import { useSelector } from "react-redux";
import type { StateType } from "../store";
import type { PageInfoType } from "../store/pageInfoReducer";

function useGetPageInfo() {
  const pageInfo = useSelector<StateType>(
    (state) => state.pageInfo
  ) as PageInfoType;
  const { title, desc, js, css, isPublished } = pageInfo;
  return {
    title,
    desc,
    js,
    css,
    isPublished,
  };
}

export default useGetPageInfo;
